home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume10 / logo / part06 < prev    next >
Encoding:
Internet Message Format  |  1987-06-25  |  37.8 KB

  1. Path: uunet!rs
  2. From: rs@uunet.UU.NET (Rich Salz)
  3. Newsgroups: comp.sources.unix
  4. Subject: v10i026: Logo interpreter for Unix, Part06/06
  5. Message-ID: <473@uunet.UU.NET>
  6. Date: 26 Jun 87 21:47:21 GMT
  7. Organization: UUNET Communications Services, Arlington, VA
  8. Lines: 909
  9. Approved: rs@uunet.uu.net
  10.  
  11. Submitted by: Brian Harvey <bh@mit-amt>
  12. Mod.Sources: Volume 10, Number 26
  13. Archive-Name: logo/Part06
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 6 (of 6)."
  22. # Contents:  logoman.2
  23. # Wrapped by rsalz@pineapple.bbn.com on Wed Jun 24 14:27:02 1987
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. if test -f logoman.2 -a "${1}" != "-c" ; then 
  26.   echo shar: Will not over-write existing file \"logoman.2\"
  27. else
  28. echo shar: Extracting \"logoman.2\" \(36119 characters\)
  29. sed "s/^X//" >logoman.2 <<'END_OF_logoman.2'
  30. X\f3pendown\f1 \(em Command, no inputs.  Abbreviation: \f3pd\f1
  31. X.IN
  32. XThis command tells the turtle to lower its pen, so that
  33. Xlater commands will draw lines when the turtle moves.
  34. X.OU
  35. X\f3penerase\f1 \(em Command, no inputs.  Abbreviation: \f3pe\f1
  36. X.IN
  37. XThis command tells the turtle to "lower its eraser", so that lines
  38. Xpreviously drawn will be erased when retraced by the turtle.  It
  39. Xonly works with the display turtle.  The commands \f3penup\f1,
  40. X\f3pendown\f1, \f3penerase\f1, and \f3penreverse\f1
  41. Xare mutually exclusive; whichever
  42. Xwas most recently used is the one which affects the turtle.  (Graphics
  43. Xterminals which cannot selectively erase lines, such as Tektronix
  44. Xdisplays, will treat \f3penerase\f1 as \f3pendown\f1.)
  45. X.OU
  46. X\f3penreverse\f1 \(em Command, no inputs.  Abbreviation: \f3px\f1
  47. X.IN
  48. XThis command tells the display turtle to lower its "reversing pen";
  49. Xthereafter, when the turtle moves, it turns on any points which were
  50. Xoff, and turns off any points which were on.  The commands \f3penup\f1,
  51. X\f3pendown\f1, \f3penerase\f1, and \f3penreverse\f1 are mutually
  52. Xexclusive; whichever was most recently used is the one which affects the
  53. Xturtle.  (Note:  Graphics terminals which cannot penreverse will treat
  54. Xthis command as \f3pendown\f1.)
  55. X.OU
  56. X\f3penmode\f1 \(em Operation, no inputs.
  57. X.IN
  58. XThis operation applies to the floor or the display turtle.  It outputs one
  59. Xof the words \f3penup\f1, \f3pendown\f1, \f3penerase\f1, or
  60. X\f3penreverse\f1, depending on the current state of the turtle's pen.
  61. X.OU
  62. X\f3lampon\f1 \(em Command, no inputs.  Abbreviation: \f3lon\f1
  63. X.IN
  64. XThis command applies only to the floor turtle; it turns on the
  65. Xheadlamps on the front of the turtle.
  66. X.OU
  67. X\f3lampoff\f1 \(em Command, no inputs.  Abbreviation: \f3loff\f1
  68. X.IN
  69. XThis command turns off the floor turtle's headlamps.
  70. X.OU
  71. X\f3hitoot\f1 \(em Command, one input.  Abbreviation: \f3hit\f1
  72. X.IN
  73. XThis command applies only to the floor turtle.  It sounds the
  74. Xturtle's horn at the higher of its two pitches.  The input is
  75. Xa number which indicates the number of quarter-seconds to toot
  76. Xthe horn.  Note: large numbers are likely to lead to violent
  77. Xbehavior on the part of other computer users.
  78. X.OU
  79. X\f3lotoot\f1 \(em Command, one input.  Abbreviation: \f3lot\f1
  80. X.IN
  81. XThis command sounds the floor turtle's horn at the lower of
  82. Xits two pitches.  The input is the duration of the toot.
  83. X.OU
  84. X\f3ftouch\f1 \(em Operation (predicate), no inputs.  Abbreviation: \f3fto\f1
  85. X.IN
  86. XThis operation can be used only with the floor turtle.  It has as its
  87. Xoutput the word \f3true\f1 if the front of the turtle is touching an
  88. Xobstacle; otherwise it has the word \f3false\f1 as its output.
  89. X.OU
  90. X\f3btouch\f1 \(em Operation (predicate), no inputs.  Abbreviation: \f3bto\f1
  91. X.IN
  92. XThis operation can be used only with the floor turtle.  It has as its
  93. Xoutput the word \f3true\f1 if the back of the turtle is touching an
  94. Xobstacle; otherwise it has the word \f3false\f1 as its output.
  95. X.OU
  96. X\f3ltouch\f1 \(em Operation (predicate), no inputs.  Abbreviation: \f3lto\f1
  97. X.IN
  98. XThis operation can be used only with the floor turtle.  It has as its
  99. Xoutput the word \f3true\f1 if the left side of the turtle is touching an
  100. Xobstacle; otherwise it has the word \f3false\f1 as its output.
  101. X.OU
  102. X\f3rtouch\f1 \(em Operation (predicate), no inputs.  Abbreviation: \f3rto\f1
  103. X.IN
  104. XThis operation can be used only with the floor turtle.  It has as its
  105. Xoutput the word \f3true\f1 if the right side of the turtle is touching an
  106. Xobstacle; otherwise it has the word \f3false\f1 as its output.
  107. X.OU
  108. X\f3clearscreen\f1 \(em Command, no inputs.  Abbreviation: \f3cs\f1
  109. X.IN
  110. XThis command applies only to the display turtle.  It erases everything
  111. Xon the TV screen, and restores the turtle to its initial position and
  112. Xheading (center of the screen, facing toward the top edge).
  113. X.OU
  114. X\f3wipeclean\f1 \(em Command, no inputs.  Abbreviation: \f3clean\f1
  115. X.IN
  116. XThis command applies only to the display turtle.  It erases everything
  117. Xon the TV screen, but does not change the turtle's position or heading.
  118. X.OU
  119. X\f3fullscreen\f1 \(em Command, no inputs.  Abbreviation: \f3full\f1
  120. X.IN
  121. XThis command applies only to the Atari display turtle.  It eliminates the
  122. Xuse of the bottom four lines of the screen to display the commands
  123. Xyou type; instead, the entire screen is available to show the
  124. Xpicture drawn by the turtle.  However, you can no longer see
  125. Xwhat you're typing.  The command may be used after the picture is
  126. Xalready drawn; the part "hidden" by the text at the bottom of
  127. Xthe screen will become visible.  On other displays, \f3fullscreen\f1 and
  128. X\f3splitscreen\f1 are equivalent; they make the entire screen available
  129. Xfor graphics, and text appears on the bottom line (Gigis) or superimposed
  130. X(ADMs), or somewhere.
  131. X.OU
  132. X\f3splitscreen\f1 \(em Command, no inputs.  Abbreviation: \f3split\f1
  133. X.IN
  134. XThis command applies only to the Atari display turtle.  It restores the
  135. Xnormal text display at the bottom of the screen, undoing the
  136. Xeffect of the \f3full\f1 command.  On other displays, \f3fullscreen\f1 and
  137. X\f3splitscreen\f1 are equivalent; they make the entire screen available
  138. Xfor graphics, with text superimposed in a display-dependent area.
  139. X.OU
  140. X\f3textscreen\f1 \(em Command, no inputs.  Abbreviation: \f3text\f1
  141. X.IN
  142. XThis command applies only to the display turtle.  It temporarily
  143. Xremoves the turtle display from the screen, making the entire
  144. Xscreen available for text display.  The commands \f3fullscreen\f1 and
  145. X\f3splitscreen\f1 will restore the graphics display.  Note:  On the Atari
  146. Xdisplay, the picture on the screen is remembered, so that when you return
  147. Xto \f3fullscreen\f1 or \f3splitscreen\f1 mode, the picture returns to the
  148. Xscreen.  On other displays, the picture is forgotten, and you return to
  149. Xan empty graphics screen.
  150. X.OU
  151. X\f3hideturtle\f1 \(em Command, no inputs.  Abbreviation: \f3ht\f1
  152. X.IN
  153. XThis command applies only to the display turtle.  It erases the
  154. Xdisplay of the turtle itself from the screen, so that only the
  155. Xlines drawn when the turtle moves are visible.  The display is
  156. Xfaster when the turtle is hidden (only slightly faster on the Atari,
  157. Xbut much faster on other terminals).  Also, once a graphics
  158. Xprogram is debugged, it may be prettier to watch without the
  159. Xturtle visible.  (Note:  On the Tektronix display, the turtle is
  160. Xnever visible, because the terminal cannot erase selectively.)
  161. X.OU
  162. X\f3showturtle\f1 \(em Command, no inputs.  Abbreviation: \f3st\f1
  163. X.IN
  164. XThis command applies only to the display turtle.  It restores
  165. Xthe display of the turtle, after the \f3hideturtle\f1 command
  166. Xhas been used.  (Note:  On the Tektronix display, the turtle is
  167. Xnever visible.)
  168. X.OU
  169. X\f3shownp\f1 \(em Operation (predicate), no inputs.
  170. X.IN
  171. XThis predicate applies only to the display turtle.  It outputs the word
  172. X\f3true\f1 if the turtle is visible on the TV screen, \f3false\f1 otherwise.
  173. X.OU
  174. X\f3pencolor\f1 \(em Command, one input.  Abbreviation: \f3penc\f1
  175. X.IN
  176. XThis command applies only to the display turtle.  Its effect is different
  177. Xdepending on how each type of terminal supports color.  For the Atari, the
  178. Xinput must be
  179. Xan integer between 0 and 6.  An input of 0 enters black-and-white
  180. Xdisplay mode (which is the turtle's initial mode), in which lines
  181. Xare as thin as possible but there is no control of color.  Any other
  182. Xinput selects color mode, in which lines are twice as thick, so the
  183. Xeffective size of the screen is smaller, but colors can be used.  There
  184. Xare, in color mode, three possible pen colors, numbered 1 to 3.  There
  185. Xare 256 possible colors, but only three can be on the screen at a time;
  186. Xthe \f3setcolor\f1 command is used to decide which pen draws in which
  187. Xactual color.  If the input is 4, 5, or 6, the color is that of pen
  188. X1, 2, or 3, respectively, but lines are drawn in "fill mode": for each
  189. Xpoint inked, all points to its right are also inked until a point is
  190. Xreached which was already inked.  On the Gigi, there is only one mode, and
  191. Xthere is no loss of resolution in using color.  The input must be between
  192. X0 and 7; 0 means black, 7 means white.  The ADM, Tektronix, and Sun displays
  193. Xdo not have multi-color drawing.
  194. X.OU
  195. X\f3setcolor\f1 \(em Command, two inputs.  Abbreviation: \f3setc\f1
  196. X.IN
  197. XThis command applies only to the Atari display turtle.  The first input
  198. Xmust be an integer between 0 and 3.  If the input is nonzero, the
  199. Xsecond input specifies the color for the pen selected by the first
  200. Xinput.  If the first input is zero, the second input specifies the
  201. Xbackground color for the color graphics display.  The second input
  202. Xis either an integer between 0 and 15, which is a color number, or
  203. Xa list of two integers, in which case the first is a color number
  204. Xand the second is an intensity number, an integer between 0 and 7.
  205. X.OU
  206. X\f3setxy\f1 \(em Command, two inputs.
  207. X.IN
  208. XThe two inputs must be numbers.  The turtle is moved to the point
  209. Xon the screen whose x (horizontal) coordinate is the first input,
  210. Xand whose y (vertical) coordinate is the second input.  The center
  211. Xof the screen, where the turtle starts, has both coordinates zero.
  212. XIf the pen is down, this command draws a line.  This command
  213. Xapplies only to the display turtle.
  214. X.OU
  215. X\f3setheading\f1 \(em Command, one input.  Abbreviation: \f3seth\f1
  216. X.IN
  217. XThe input must be a number.  The turtle's heading is set to the
  218. Xinput, taken in degrees.  Zero points straight up, as the turtle
  219. Xstarts out; positive headings are clockwise from zero.  This command
  220. Xapplies only to the display turtle.
  221. X.OU
  222. X\f3towardsxy\f1 \(em Operation, two inputs.
  223. X.IN
  224. XThis operation applies only to the display turtle.  The two inputs must
  225. Xbe numbers, which are the x and y coordinates of a point on the TV
  226. Xscreen.  The output is a number which is the heading to which the turtle
  227. Xmust be set, in order to point towards that point from its current
  228. Xposition.  Note: this operation does not actually move or turn the
  229. Xturtle.  You must use it as the input to \f3setheading\f1 if that is
  230. Xwhat you want.
  231. X.OU
  232. X\f3xcor\f1 \(em Operation, no inputs.
  233. X.IN
  234. XThe output is the turtle's current x (horizontal) coordinate.  The
  235. Xoperation works only with the display turtle.
  236. X.OU
  237. X\f3ycor\f1 \(em Operation, no inputs.
  238. X.IN
  239. XThe output is the turtle's current y (vertical) coordinate.  This
  240. Xoperation works only with the display turtle.
  241. X.OU
  242. X\f3heading\f1 \(em Operation, no inputs.
  243. X.IN
  244. XThe output is the turtle's current heading in degrees.  This operation
  245. Xworks only with the display turtle.
  246. X.OU
  247. X\f3getpen\f1 \(em Operation, no inputs.
  248. X.IN
  249. XThe output is the turtle's current pen color, or (on the Atari) zero
  250. Xif in black-and-white
  251. Xmode.  This operation works only with the display turtle.
  252. X.OU
  253. X\f3setscrunch\f1 \(em Command, one input.  Abbreviation: \f3setscrun\f1
  254. X.IN
  255. XThis command is used only for display turtles.  The
  256. Xinput must be a number.  The vertical component of turtle motion is
  257. Xmultiplied by this number before each motion is taken.  If squares come
  258. Xout too wide on your screen, you should increase the number; if too tall,
  259. Xyou should decrease it.  (You can also use \f3setscrunch\f1 to deform the
  260. Xturtle's motion on purpose, so for example a circle program will draw
  261. Xan ellipse instead.)  The initial scrunch value depends on the terminal
  262. Xyou are using: for the Atari and the Gigi, it is around 0.8 (your particular
  263. Xcomputer center will adjust this for the particular TV monitors you use),
  264. Xbut for the ADM, Tektronix, and Sun, it is 1.0 because these terminals
  265. Xdisplay the same size steps horizontally and vertically.
  266. X.OU
  267. X\f3scrunch\f1 \(em Operation, no inputs.
  268. X.IN
  269. XThis operation is used only for display turtles.  It outputs a number, which
  270. Xis the scrunch factor (or aspect ratio) by which vertical motion is
  271. Xmultiplied before it is displayed.  This number is changed using the
  272. X\f3setscrunch\f1 command.
  273. X.OU
  274. X.ti +5
  275. X.UB "Primitive procedures for arithmetic."
  276. XSeveral procedures
  277. Xare available for arithmetic operations on numbers.  In all
  278. Xcases, the inputs to these procedures must be numbers, except
  279. Xas otherwise indicated in the individual descriptions.
  280. X.PP
  281. XIn general, procedures are used in Logo by typing first the name
  282. Xof the procedure, then its inputs.  This is true of arithmetic
  283. Xprocedures also, e.g.
  284. X.EX
  285. Xsum 3 2
  286. X.EC
  287. XHowever, for some arithmetic operations, Logo also recognizes the
  288. Xmore traditional \f2infix\f1 notation, with the operation between
  289. Xthe two inputs:
  290. X.EX
  291. X3 + 2
  292. X.EC
  293. XBe warned, though, that the use of infix forms makes it difficult
  294. Xfor Logo to know how to group operations, unless parentheses are
  295. Xused.  If you stick to the standard (in Logo) prefix notation,
  296. Xthe grouping is always unambiguous.  For example, the first two of
  297. Xthese three instructions are equivalent, but the third is not:
  298. X.EX
  299. Xif equalp count "hello 5 [print "Yes.]
  300. Xif (count "hello) = 5 [print "Yes.]
  301. Xif count "hello = 5 [print "Yes.]
  302. X.EC
  303. XThe reason for the error message produced by the last of those three
  304. Xinstructions is that Logo interprets it as
  305. X.EX
  306. Xif count equalp "hello 5 [print "Yes.]
  307. X.EC
  308. XThat is, the equality test is done first, on the word \f3hello\f1
  309. Xitself, rather than first taking the count of \f3hello\f1 as
  310. Xwas intended.
  311. X.sp 1
  312. X\f3sum\f1 \(em Operation, two inputs.  Infix: \f3+\f1
  313. X.IN
  314. XThe output of this procedure is the sum of the two inputs.
  315. X.OU
  316. X\f3difference\f1 \(em Operation, two inputs.  Abbreviation: \f3diff\f1  Infix: \f3-\f1
  317. X.IN
  318. XThe output of this procedure is the difference of the two inputs.
  319. X.OU
  320. X\f3product\f1 \(em Operation, two inputs.  Infix: \f3*\f1
  321. X.IN
  322. XThe output of this procedure is the product of the two inputs.
  323. X.OU
  324. X\f3quotient\f1 \(em Operation, two inputs.  Infix: \f3/\f1
  325. X.IN
  326. XThe output of this procedure is the quotient of the two inputs.
  327. X.OU
  328. X\f3remainder\f1 \(em Operation, two inputs.  Abbreviation: \f3mod\f1  Infix: \f3\\\f1
  329. X.IN
  330. XThe inputs to this procedure must be integers.  The output is also an
  331. Xinteger, and is the remainder of dividing the first input by the
  332. Xsecond.
  333. X.OU
  334. X\f3maximum\f1 \(em Operation, two inputs.  Abbreviation: \f3max\f1
  335. X.IN
  336. XThe output of this procedure is equal to whichever of the two inputs
  337. Xis numerically greater.
  338. X.OU
  339. X\f3minimum\f1 \(em Operation, two inputs.  Abbreviation: \f3min\f1
  340. X.IN
  341. XThe output of this procedure is equal to whichever of the two inputs
  342. Xis numerically smaller.
  343. X.OU
  344. X\f3greaterp\f1 \(em Operation (predicate), two inputs.  Infix: \f3>\f1
  345. X.IN
  346. XThe output of this procedure is the word \f3true\f1 if the first input
  347. Xis numerically strictly greater than the second input.  Otherwise the
  348. Xoutput is the word \f3false\f1.
  349. X.OU
  350. X\f3lessp\f1 \(em Operation (predicate), two inputs.  Infix: \f3<\f1
  351. X.IN
  352. XThe output of this procedure is the word \f3true\f1 if the first input
  353. Xis numerically strictly less than the second input.  Otherwise the
  354. Xoutput is the word \f3false\f1.
  355. X.OU
  356. X\f3equalp\f1 \(em Operation (predicate), two inputs.  Infix: \f3=\f1
  357. X.IN
  358. XThe two inputs to this procedure may be any Logo objects.  If they
  359. Xare numbers, then the output is the word \f3true\f1 if they are
  360. Xnumerically equal, \f3false\f1 if they are numerically unequal.  If
  361. Xeither input is not a number, then the output is the same as for the
  362. Xprocedure \f3is\f1: it is \f3true\f1 if the two inputs are identical,
  363. X\f3false\f1 if not.  For example, the numbers \f32\f1 and \f32.0\f1 are
  364. Xnumerically equal, but not identical.
  365. X.OU
  366. X\f3numberp\f1 \(em Operation (predicate), one input.
  367. X.IN
  368. XThe input may be any Logo object.  The output is the word \f3true\f1 if
  369. Xthe input is a number, \f3false\f1 if not.
  370. X.OU
  371. X\f3zerop\f1 \(em Operation (predicate), one input.
  372. X.IN
  373. XThe input must be a number.  The output is the word \f3true\f1 if the
  374. Xinput is numerically equal to zero, \f3false\f1 otherwise.
  375. X.OU
  376. X\f3random\f1 \(em Operation, one input.  Abbreviation: \f3rnd\f1
  377. X.IN
  378. XThe input must be a positive integer.  The output is a randomly
  379. Xselected integer between 0 and one less than the input.
  380. X.OU
  381. X\f3sqrt\f1 \(em Operation, one input.
  382. X.IN
  383. XThe input must be a nonnegative number.  The output is its square root.
  384. X.OU
  385. X\f3pow\f1 \(em Operation, two inputs.
  386. X.IN
  387. XThe inputs must be numbers.  If the first is negative, the second must
  388. Xbe an integer.  The output is the first number raised to the power of
  389. Xthe second input.
  390. X.OU
  391. X\f3sin\f1 \(em Operation, one input.
  392. X.IN
  393. XThe input must be numeric.  The output is the sine of the input, taken
  394. Xin degrees, not radians.
  395. X.OU
  396. X\f3cos\f1 \(em Operation, one input.
  397. X.IN
  398. XThe input must be numeric.  The output is the cosine of the input, taken
  399. Xin degrees, not radians.
  400. X.OU
  401. X\f3arctan\f1 \(em Operation, one input.  Abbreviation: \f3atan\f1
  402. X.IN
  403. XThe input must be numeric.  The output is the arctangent, in degrees, of
  404. Xthe input.
  405. X.OU
  406. X.ti +5
  407. X.UB "Primitive procedures for conditional execution."
  408. XThe predicates
  409. X(like \f3wordp\f1) which we've mentioned above can be used to carry out
  410. Xsome command only if a condition is met.  The basic command for the
  411. Xpurpose is \f3if\f1:
  412. X.sp 1
  413. X\f3if\f1 \(em Command or operation, two or three inputs.
  414. X.IN
  415. XThe first input to the \f3if\f1 procedure must be either the word \f3true\f1 or
  416. Xthe word \f3false\f1.  Typically, it is the output from a predicate.  The second
  417. Xand (optional) third inputs are lists containing instruction lines.  The second
  418. Xinput is executed if the first input is \f3true\f1.  The third input, if any,
  419. Xis executed if the first input is \f3false\f1:
  420. X.sp 1
  421. X.nf
  422. X\f3to greet :person
  423. Xif equalp :person [Ronald Reagan] [print [Hi, turkey!]] \\
  424. X    [print sentence "Hi, :person]
  425. Xend\f1
  426. X.fi
  427. X.sp 1
  428. XIn that example, the first input to \f3if\f1 is the output from the expression
  429. X.br
  430. X\f3equalp :person [Ronald Reagan]\f1.
  431. X.sp 1
  432. XThe \f3if\f1 procedure can be used as an operation, producing a value.  In this
  433. Xcase, the third input is required:
  434. X.sp 1
  435. X.nf
  436. X\f3print if equalp :person "Reagan ["Loser] ["Winner]\f1
  437. X.fi
  438. X.OU
  439. X\f3test\f1 \(em Command, one input.
  440. X.IN
  441. XThe input must be the word \f3true\f1 or the word \f3false\f1.  The command
  442. Xremembers its input for use in a later \f3iftrue\f1 or \f3iffalse\f1
  443. Xcommand.  This is an alternative to \f3if\f1 which is useful if several
  444. Xinstructions are to be made conditional on the same condition.  The
  445. Xremembered truth value is local to the current procedure, if any.
  446. X.OU
  447. X\f3iftrue\f1 \(em Command, one input.  Abbreviation: \f3ift\f1
  448. X.IN
  449. XThe input must be an instruction list.  It is run if the most recent
  450. X\f3test\f1 command saved a \f3true\f1 value.
  451. X.OU
  452. X\f3iffalse\f1 \(em Command, one input.  Abbreviation: \f3iff\f1
  453. X.IN
  454. XThe input must be an instruction list.  It is run if the most recent
  455. X\f3test\f1 command saved a \f3false\f1 value.
  456. X.OU
  457. X\f3both\f1 \(em Operation (predicate), two inputs.  Abbreviation: \f3and\f1
  458. X.IN
  459. XThe two inputs must both be either \f3true\f1 or \f3false\f1.  The output
  460. Xis \f3true\f1 if both inputs are \f3true\f1; otherwise the output is
  461. X\f3false\f1.
  462. X.OU
  463. X\f3either\f1 \(em Operation (predicate), two inputs.  Abbreviation: \f3or\f1
  464. X.IN
  465. XThe two inputs must be either \f3true\f1 or \f3false\f1.  The output
  466. Xis \f3true\f1 if at least one of the inputs is \f3true\f1; otherwise
  467. Xthe output is \f3false\f1.
  468. X.OU
  469. X\f3not\f1 \(em Operation (predicate), one input.
  470. X.IN
  471. XThe input must be either \f3true\f1 or \f3false\f1.  The output is
  472. X\f3true\f1 if the input is \f3false\f1, and vice versa.
  473. X.OU
  474. X.ti +5
  475. X.UB "Primitive procedures for file input and output."
  476. XIn the Unix
  477. Xoperating system, there are two steps in reading or writing files: first,
  478. Xthe file must be \f2opened\f1, thereby associating a "file descriptor"
  479. X(an integer) with the file name; second, the file descriptor is used
  480. Xto specify the file for each read or write operation.  Logo has
  481. Xprimitive procedures for each of these steps.
  482. X.sp 1
  483. X\f3openread\f1 \(em Operation, one input.  Abbreviation: \f3openr\f1
  484. X.IN
  485. XThe input to this procedure is a word, which must be a Unix filename.  It
  486. Xcan contain slashes to indicate directory names.  If the file can be
  487. Xopened for reading, the output from the procedure is a file descriptor,
  488. Xwhich should be stored in a variable for use in reading the file.  If the
  489. Xfile cannot be opened, an error results.
  490. X.OU
  491. X\f3fileread\f1 \(em Operation, one input.  Abbreviation: \f3fird\f1
  492. X.IN
  493. XThe input must be a file descriptor, previously output by \f3openread\f1.  The
  494. Xprocedure reads one line from the file.  The output is the line, in the form
  495. Xof a list.  (That is, the output is the file line as if enclosed in square
  496. Xbrackets in a program.)  If the end of the file has been reached, the output
  497. Xis the empty word.  If the file line contains mismatched brackets, trouble
  498. Xmay result.
  499. X.OU
  500. X\f3fileword\f1 \(em Operation, one input.  Abbreviation: \f3fiwd\f1
  501. X.IN
  502. XThe input must be a file descriptor, open for reading.  The procedure
  503. Xreads one line from the file.  The output is that line, in the form of
  504. Xa single word, including spaces and punctuation characters.  If the end
  505. Xof the file has been reached, the output is the empty list.
  506. X.OU
  507. X\f3openwrite\f1 \(em Operation, one input.  Abbreviation: \f3openw\f1
  508. X.IN
  509. XThe input must be a Unix filename.  The file is opened for writing
  510. X(replacing any previous version), if allowed, and the output is a file
  511. Xdescriptor, for use by file printing commands below.  If the file
  512. Xcannot be opened, an error results.
  513. X.OU
  514. X.nf
  515. X\f3fileprint\f1 \(em Command, two inputs.  Abbreviation: \f3fip\f1
  516. X\f3filetype\f1 \(em Command, two inputs.  Abbreviation: \f3fity\f1
  517. X\f3filefprint\f1 \(em Command, two inputs.  Abbreviation: \f3fifp\f1
  518. X\f3fileftype\f1 \(em Command, two inputs.  Abbreviation: \f3fifty\f1
  519. X.fi
  520. X.IN
  521. XThe first input must be a file descriptor previously output by
  522. X\f3openwrite\f1.  The second input is any object.  The second input
  523. Xis printed (typed, fprinted, ftyped) into the file.
  524. X.OU
  525. X\f3close\f1 \(em Command, one input.
  526. X.IN
  527. XThe input must be a file descriptor.  The file is closed.  This must
  528. Xbe done when you've finished reading or writing the file.
  529. X.sp 1
  530. XSample program:
  531. X.sp 1
  532. X.nf
  533. X\f3make "fd openwrite "outfile
  534. Xfileprint :fd "Hello.
  535. Xclose :fd\f1
  536. X.fi
  537. X.sp 1
  538. XThis will create a file named \f3outfile\f1 containing the word \f3Hello.\f1
  539. X.OU
  540. X.ti +5
  541. X.UB "Primitive procedures for procedure exit."
  542. XA procedure written by
  543. Xa user, in Logo, can be a command or an operation.  If it is an operation,
  544. Xyou must, in the procedure, say what its output should be.  If it is a
  545. Xcommand, it can simply stop at the end of the procedure, or you can explicitly
  546. Xmake it stop before the end.
  547. X.sp 1
  548. X\f3output\f1 \(em Command, one input.  Abbreviation: \f3op\f1
  549. X.IN
  550. XThis command is used in a user procedure which is meant to be an
  551. Xoperation.  The input to this command becomes the output from the
  552. Xuser procedure.  Please don't be confused by the fact that the user
  553. Xprocedure is an operation, while the \f3output\f1 primitive
  554. Xprocedure is a command used in that procedure.  Example:
  555. X.sp 1
  556. X.nf
  557. X\f3to nickname :person
  558. Xif equalp :person [Peter Parker] [output "Spiderman]
  559. Xif equalp :person [Lamont Cranston] [output "Shadow]
  560. Xoutput first :person
  561. Xend\f1
  562. X.fi
  563. X.OU
  564. X\f3stop\f1 \(em Command, no inputs.
  565. X.IN
  566. XThis command is used in user procedures which are meant to be
  567. Xcommands.  It stops the user procedure.  (Note that it does not
  568. Xstop all running procedures.  If user procedure A runs user procedure
  569. XB, a \f3stop\f1 command in procedure B returns to procedure A, which
  570. Xcontinues after the point where procedure B was invoked.)
  571. X.OU
  572. X\f3toplevel\f1 \(em Command, no inputs.
  573. X.IN
  574. XThis command stops all running procedures.  The user at the terminal
  575. Xis prompted to type another command.  This can be used when a user
  576. Xprocedure discovers some error condition and wants to abort the entire
  577. Xprogram, for example.
  578. X.OU
  579. X.ti +5
  580. X.UB "Property lists."
  581. XIt is possible to associate with any name a list
  582. Xof "properties".  A property list contains property names and property
  583. Xvalues.  For example:
  584. X.IN
  585. X.nf
  586. X.sp 1
  587. X\f3pprop "bh "firstname "Brian
  588. Xpprop "bh "lastname "Harvey\f1
  589. X.fi
  590. X.OU
  591. XThe form of a property list is
  592. X.EX
  593. X[name1 val1 name2 val2 name3 val3]
  594. X.EC
  595. XAlthough this data structure could be created using other Logo primitives,
  596. Xspecial property list primitives are provided because they are faster.  The
  597. Xproperty lists do not share storage with Logo variables, so you can change
  598. Xthe value of any property without having to recopy the entire property list
  599. Xas you would ordinarily.  The following primitives manipulate property lists.
  600. X.sp 1
  601. X\f3pprop\f1 \(em Command, three inputs.
  602. X.IN
  603. XThe first input, which must be a word, is a name with which a property list
  604. Xis associated.  The second input, which must be a word, is the name of a
  605. Xproperty.  The third input can be any Logo object.  It becomes the value
  606. Xof the specified property of the specified name.
  607. X.OU
  608. X\f3gprop\f1 \(em Operation, two inputs.
  609. X.IN
  610. XBoth inputs must be words.  The first is a name, and the second is a
  611. Xproperty name.  The output is the value of the indicated property of the
  612. Xindicated object.  It is not an error if there is no such property;
  613. Xthe output in that case is the empty list.
  614. X.OU
  615. X\f3remprop\f1 \(em Command, two inputs.
  616. X.IN
  617. XThe inputs must be words, as for \f3gprop\f1.  The specified property
  618. Xis removed from the specified name.
  619. X.OU
  620. X\f3plist\f1 \(em Operation, one input.
  621. X.IN
  622. XThe input must be a word, which is a name.  The output is the property
  623. Xlist of the specified name.  Note: the output is actually a copy of the
  624. Xproperty list.  The real property list is not a Logo list.  Any later
  625. Xchanges to the properties of the specified name will not change the
  626. Xlist which was output by an earlier \f3plist\f1.
  627. X.OU
  628. X\f3pps\f1 \(em Command, no inputs.
  629. X.IN
  630. XAll properties of all names are listed on your terminal.
  631. X.OU
  632. X.ti +5
  633. X.UB "Pausing."
  634. XWhen you are debugging a complicated Logo program, it is
  635. Xvery helpful to be able to stop in the middle of a procedure, so that you
  636. Xcan give interactive commands to examine its inputs and other local
  637. Xvariables.  This is different from stopping a procedure, which destroys
  638. Xits local environment.  There are three ways a procedure can pause:  (1) You
  639. Xcan include the command \f3pause\f1 in the procedure definition, to make the
  640. Xprocedure pause at a particular place you choose in advance; (2) you can
  641. Xdecide to pause a procedure while it is running by typing the system
  642. X"interrupt" character (this is control-C at Lincoln-Sudbury but is different
  643. Xon other systems); or (3) you can arrange for an error in the processing of
  644. Xthe procedure to pause instead of stopping as it usually does.
  645. X.PP
  646. XNote that when you type the system "quit" character (control-G at
  647. XLincoln-Sudbury) Logo does not pause, but returns to toplevel.  All
  648. Xinformation about the local state of your active procedures is lost.
  649. X.PP
  650. XWhen you are paused, Logo accepts instructions from your terminal as it
  651. Xdoes at toplevel, but local variables can be examined or modified.  To let
  652. Xyou know that you are paused, Logo prompts with the characters "\f3-?\f1"
  653. Xinstead of just "\f3?\f1" as usual.  It is possible to pause within a
  654. Xprocedure within a pause; in this case your prompt is "\f3--?\f1" to
  655. Xindicate two levels of pause.  This can be continued to higher levels.
  656. X.PP
  657. XTo get out of a pause, there are three things you can do.  You can give the
  658. Xcommand \f3toplevel\f1, which stops all pending procedures and returns to
  659. Xinteractive top level.  You can give the command \f3stop\f1 or the command
  660. X\f3output\f1 with an input, which will terminate the current procedure
  661. X(without or with an output respectively) and return to its calling
  662. Xprocedure.  Or you can give the command \f3continue\f1, which will resume
  663. Xthe procedure at the point where you paused.
  664. X.sp 1
  665. X\f3pause\f1 \(em Command, no inputs.
  666. X.IN
  667. XThis command is meaningful only within a procedure.  It causes a pause.
  668. X.OU
  669. X\f3continue\f1 \(em Command, no inputs.  Abbreviation: \f3co\f1
  670. X.IN
  671. XThis command is meaningful only when typed during an interactive pause.  It
  672. Xcontinues the current procedure from where it was paused.
  673. X.OU
  674. X\f3errpause\f1 \(em Command, no inputs.
  675. X.IN
  676. XThis command tells Logo that any errors which happen during procedure
  677. Xexecution from now on should cause a pause, rather than a return to
  678. Xtoplevel.
  679. X.OU
  680. X\f3errquit\f1 \(em Command, no inputs.
  681. X.IN
  682. XThis command tells Logo that any errors which happen during procedure
  683. Xexecution from now on should return to toplevel, rather than pausing.  This
  684. Xis the initial state of affairs when you start Logo.
  685. X.OU
  686. X\f3setqpause\f1 \(em Command, no inputs.
  687. X.IN
  688. XThis command tells Logo that from now on, the system quit character should
  689. Xpause, and the system interrupt character should return to toplevel.  This
  690. Xis the reverse of the usual interpretation.  This command is provided for
  691. Xpeople whose systems or keyboards make one of these characters easier to
  692. Xtype than the other.  In particular, under Eunice there is only an interrupt
  693. Xcharacter, not a quit character.
  694. X.OU
  695. X\f3setipause\f1 \(em Command, no inputs.
  696. X.IN
  697. XThis command tells Logo that from now on, the system interrupt character
  698. Xshould pause, and the system quit character should return to toplevel.  This
  699. Xis the initial state of affairs when you start Logo.
  700. X.OU
  701. X.ti +5
  702. X.UB "Miscellaneous primitives."
  703. XThe remaining primitives are one
  704. Xof a kind, or very obscure, or both.
  705. X.sp 1
  706. X\f3goodbye\f1 \(em Command, no inputs.  Abbreviation: \f3bye\f1
  707. X.IN
  708. XThis command is used to leave Logo.  It is the only way out, unless
  709. Xthere is a bug somewhere.
  710. X.OU
  711. X\f3thing\f1 \(em Operation, one input.
  712. X.IN
  713. XThe input must be a word, and must be the name of a variable.  The
  714. Xoutput is the value of the variable.  These are equivalent:
  715. X.sp 1
  716. X.nf
  717. X\f3:foo
  718. Xthing "foo\f1
  719. X.fi
  720. X.OU
  721. X\f3namep\f1 \(em Operation (predicate), one input.
  722. X.IN
  723. XThe input must be a word.  The output is \f3true\f1 if that word is the
  724. Xname of a variable which has a value assigned to it, \f3false\f1 otherwise.
  725. X.OU
  726. X\f3wait\f1 \(em Command, one input.
  727. X.IN
  728. XThe input must be a positive integer.  Logo waits that many seconds
  729. Xbefore continuing.
  730. X.OU
  731. X\f3trace\f1 \(em Command, no inputs.
  732. X.IN
  733. XThis command is used for debugging your Logo programs.  After you use
  734. Xthis command, every time a user-defined procedure starts or stops, a
  735. Xmessage is typed at your terminal naming the procedure and its inputs
  736. Xor its output, if any.  The message is indented according to the depth
  737. Xin procedure calls.
  738. X.OU
  739. X\f3untrace\f1 \(em Command, no inputs.
  740. X.IN
  741. XThis command turns off the trace messages started by the \f3trace\f1
  742. Xcommand.
  743. X.OU
  744. X\f3unix\f1 \(em Command, one input.
  745. X.IN
  746. XThe input must be a Unix shell command, which is carried out in a
  747. Xforked shell.  (/bin/sh is used, not csh.)  Example:
  748. X.sp 1
  749. X.nf
  750. X\f3to whois :user
  751. Xunix (sentence "grep (word "'^ :user ":') "/etc/inquir)
  752. Xend\f1
  753. X.fi
  754. X.OU
  755. X\f3run\f1 \(em Command or operation, one input.
  756. X.IN
  757. XThe input must be a list, containing a Logo instruction line.  The list is
  758. Xrun as if you typed it directly to Logo.  Example:
  759. X.sp 1
  760. X.nf
  761. X\f3to while :condition :cmd
  762. Xif not run :condition [stop]
  763. Xrun :cmd
  764. Xwhile :condition :cmd
  765. Xend
  766. X.sp 1
  767. Xmake "number 1
  768. Xwhile [:number < 5] [print :number; make "number :number+1]\f1
  769. X.fi
  770. X.sp 1
  771. XThe \f3run\f1 procedure can be used as an operation, if its input is a Logo
  772. Xexpression which produces a value, instead of a complete instruction:
  773. X.sp 1
  774. X\f3print run [sum 2 3]\f1
  775. X.OU
  776. X\f3repeat\f1 \(em Command, two inputs.
  777. X.IN
  778. XThe first input must be a positive number.  The second is an instruction list,
  779. Xas for the \f3run\f1 command.  The list is run repeatedly, the number of times
  780. Xspecified by the first input:
  781. X.sp 1
  782. X\f3repeat 5 [print "hello]\f1
  783. X.OU
  784. X\f3repcount\f1 \(em Operation, no inputs.
  785. X.IN
  786. XThis operation may be used only within the range of a \f3repeat\f1 command.  It
  787. Xoutputs the number of repetitions which have been done, including the current
  788. Xone.  That is, it outputs 1 the first time through, 2 the second time, and
  789. Xso on.
  790. X.OU
  791. X\f3break\f1 \(em Command, no inputs.
  792. X.IN
  793. XThis command is only meaningful within the range of an \f3if\f1 command
  794. Xwithin the range of a \f3repeat\f1 command.  It terminates the repeat
  795. Ximmediately.  If used in other contexts, the results may be strange.
  796. X.OU
  797. X\f3cbreak\f1 \(em Command, one input.
  798. X.IN
  799. XThe input must be either the word \f3on\f1 or the word \f3off\f1.  If
  800. Xthe input is \f3on\f1, your terminal is placed in cbreak mode, which
  801. Xmeans that what you type is made available to your program every
  802. Xcharacter, rather than every line.  This must be done before the
  803. X\f3readchar\f1 procedure, below, will work.  This facility is good for
  804. Xwriting video game programs or text editors.  While in cbreak mode, echo
  805. Xis turned off also.
  806. X.OU
  807. X\f3readchar\f1 \(em Operation, no inputs.  Abbreviation: \f3rc\f1
  808. X.IN
  809. XThis operation waits for you to type a single character at your terminal.  The
  810. Xoutput is a word containing only that character.  This works only if you
  811. Xhave turned on cbreak mode; see above.
  812. X.OU
  813. X\f3keyp\f1 \(em Operation (predicate), no inputs.
  814. X.IN
  815. XThis procedure outputs \f3true\f1 if there is a character waiting to
  816. Xbe read from the terminal, if you are in cbreak mode.  If not, it
  817. Xoutputs \f3true\f1 if there is an entire line waiting to be read.
  818. X.OU
  819. X\f3cleartext\f1 \(em Command, no inputs.  Abbreviation: \f3ct\f1
  820. X.IN
  821. XThis command clears the screen.  It uses termlib to be terminal-independent.
  822. X.OU
  823. X\f3setcursorxy\f1 \(em Command, two inputs.  Abbreviation: \f3setcxy\f1
  824. X.IN
  825. XThis command positions the terminal cursor to the column and row specified
  826. Xby the two inputs, which must be integers.  It uses termlib to support a
  827. Xwide variety of terminals, but not every terminal is capable of cursor
  828. Xaddressing.  There is a library procedure setcursor that takes one input,
  829. Xa list of two numbers, column and row.
  830. X.OU
  831. X\f3oflush\f1 \(em Command, no inputs.
  832. X.IN
  833. XNormally, when you tell Logo to print something, the printing is not done
  834. Xright away.  Instead, Logo remembers everything you tell it to print, and the
  835. Xprinting is done all at once the next time Logo is waiting for you to type
  836. Xsomething.  This arrangement makes Logo much faster than it would be if
  837. Xeverything were printed immediately.  The \f3oflush\f1 command tells Logo to
  838. Xprint whatever you've previously asked for right away, without waiting.
  839. X.OU
  840. X\f3help\f1 \(em Command, no inputs.
  841. X.IN
  842. XThis command types at your terminal a brief message about Logo and
  843. Xhow to use it.
  844. X.OU
  845. X\f3describe\f1 \(em Command, one input.
  846. X.IN
  847. XThe input must be the name of a Logo primitive procedure.  A brief
  848. Xexplanation of that primitive is typed at your terminal.
  849. X.OU
  850. X\f3go\f1 \(em Command, one input.
  851. X.IN
  852. XThis command can be used only inside a procedure.  The input must be a
  853. Xnumber.  The same number must appear at the beginning of some line in
  854. Xthe same procedure.  (This line number is otherwise ignored.)
  855. XThe next command executed will be
  856. Xthe one on the indicated line in the definition.  Note: there is always
  857. Xa better way to do it.  If you have previously programmed in BASIC, your
  858. Xonly hope of ever really learning how to program computers is NEVER EVER
  859. Xto use the \f3go\f1 command!
  860. X.OU
  861. X\f3debquit\f1 \(em Command, no inputs.
  862. X.IN
  863. XThis command is meant to be used only for debugging Logo itself.  It is
  864. Xexplained here only for completeness.  After this command is used, the
  865. XQUIT signal is not caught by Logo, so it will cause a core dump.
  866. X.OU
  867. X\f3memtrace\f1 \(em Command, no inputs.
  868. X.IN
  869. XThis command is meant to be used only for debugging Logo itself.  It is
  870. Xexplained here only for completeness.  After this command is used, every
  871. Xallocation or deallocation of memory, and every character parsed by the
  872. Xinterpreter, types an incomprehensible message at your terminal.
  873. X.OU
  874. X\f3yaccdebug\f1 \(em Command, no inputs.
  875. X.IN
  876. XThis command is meant to be used only for debugging Logo itself.  It is
  877. Xexplained here only for completeness.  After this command is used, every
  878. Xstate transition in the yacc parser types an incomprehensible message
  879. Xat your terminal.
  880. X.OU
  881. X.ti +5
  882. X.UB "The Logo library."
  883. XThe directory /usr/lib/logo contains Logo
  884. Xprocedures which are available to all users.  They are not listed by
  885. X\f3pots\f1, but can be thought of as pseudo-primitives which happen to
  886. Xbe written in Logo.  Some of these procedures are only useful in conjunction
  887. Xwith the teaching units used in Introduction to Computers, but others are
  888. Xgenerally useful.  This manual does not fully document the Logo
  889. Xlibrary, because it changes
  890. Xtoo often.  Look through the /usr/lib/logo directory yourself if you want.
  891. XThe procedures \f3setcursor\f1,
  892. X\f3listp\f1, \f3home\f1, \f3pos\f1, \f3setpos\f1, \f3towards\f1, \f3setx\f1,
  893. Xand \f3sety\f1 in the library are provided for partial compatibility with
  894. XApple Logo.
  895. X
  896. END_OF_logoman.2
  897. if test 36119 -ne `wc -c <logoman.2`; then
  898.     echo shar: \"logoman.2\" unpacked with wrong size!
  899. fi
  900. # end of overwriting check
  901. fi
  902. echo shar: End of archive 6 \(of 6\).
  903. cp /dev/null ark6isdone
  904. MISSING=""
  905. for I in 1 2 3 4 5 6 ; do
  906.     if test ! -f ark${I}isdone ; then
  907.     MISSING="${MISSING} ${I}"
  908.     fi
  909. done
  910. if test "${MISSING}" = "" ; then
  911.     echo You have unpacked all 6 archives.
  912.     echo "Now see the README"
  913.     rm -f ark[1-9]isdone
  914. else
  915.     echo You still need to unpack the following archives:
  916.     echo "        " ${MISSING}
  917. fi
  918. ##  End of shell archive.
  919. exit 0
  920.